Add break/continue/return jump statements (VAMS-2023) - #26
Merged
Conversation
Implement §5.11 jump statements: break/continue in while loops (banned in analog for), and return with a value from analog user-defined functions, with CFG lowering and validation diagnostics. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
sai-v-ch
added a commit
to sai-v-ch/OpenVAF-Reloaded
that referenced
this pull request
Aug 1, 2026
Resolves the overlap with OpenVAF#26 (break/continue/return): both branches add statement kinds to hir_def::Stmt and hir::Stmt and arms to every match over them, so each conflict is a union of the two sides. - hir_def::Stmt: EventTrigger alongside Break/Continue/Return; Break and Continue join the no-child-expression arm of walk_child_exprs, while EventControl needs its own arm for Event::Named. - hir::Stmt, hir_lower::collect_cross_assigned, hir_ty::infere_stmt and the parser's STMT_TS: union. - The two generated files (tokens/parser/generated.rs, syntax/ast/generated/nodes.rs) were regenerated from the cleanly merged ungram and KINDS_SRC rather than merged by hand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
break,continue, andreturn.break/continueare allowed inwhileloops; rejected outside loops and inside analogfor(§5.9.3).return expr;is allowed only in analog user-defined functions and requires a value of the function return type (§4.7.2.2).return).Test plan
cargo test -p hir --test data_tests ui(includes newvams2023_jumpsUI diagnostics)cargo test -p hir_lower --test data_tests mir(includes newvams2023_jumpsMIR snapshot)cargo test -p parser -p hir_def -p hir_tycargo fmton touched cratesMade with Cursor